﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Win104.IEC104
{
    public class EScaled : InformationElement
    {
        private int value;
        public EScaled(ByteBody data)
        {
            value = ((data.GetByte() & 0xFF) | ((data.GetByte() & 0xFF) << 8));
        }
        public override int Encode(byte[] buffer, int i)
        {
            int tempVal = value;
            buffer[i++] = (byte)tempVal;
            buffer[i++] = (byte)(tempVal >> 8);
            return 2;
        }
        public int GetValue() { return value; }
        public override string ToString()
        {
            return "标度化值：" + value;
        }
    }
}
